package com.wyc.mapper;

import com.wyc.pojo.Emp;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface EmpsMapper {

    //查询员工信息
    @Select("select * from  emps")
    public List<Emp> list();

    //删除
    public void delByIds(List<Integer> ids);

    //添加
    @Insert("insert into emps (username, password, name, gender, image, job, dept_id, entry_date, " +
            "create_time, update_time) " +
            "values (#{username},#{password},#{name},#{gender},#{image},#{job},#{deptId},#{entryDate}," +
            "#{createTime},#{updateTime})")
    public void save(Emp emp);

    //根据id查询
    @Select("select  *  from emps where id = #{id}")
    public Emp getById(Integer id);

    //修改
    public void update(Emp emp);

    //根据账号和密码查询
    @Select("select  * from emps where username= #{username} and password=#{password}")
    public Emp selectByUsernameAndPwd(Emp emp);

    @Delete("delete from emps where dept_id=#{deptId}")
    public void delByDeptId(Integer deptId);
}
